# -*- coding: utf-8 -*-
from django.forms import ModelForm
from apps.comment.models import Comment  
from django import forms
class CommentForm(ModelForm):
    #content = forms.Textarea(attrs={'cols': 60, 'rows': 8})
    
    class Meta:
        model = Comment
        exclude = ('author', 'content_type', 'object_id',)
        widgets = {
            'content': forms.Textarea(attrs={'cols': 60, 'rows': 8}),
        }
    
    def clean_content(self):
        content = self.cleaned_data['content']
        if len(content) > 1000 :
            raise forms.ValidationError("您写得太多了，一千字就够了")
        return content
    

    